<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
		<meta HTTP-EQUIV="Expires" CONTENT="-1">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>注册</title>
		<link rel="shortcut icon" href="img/favicon.ico" />
		<link rel="bookmark" href="img/favicon.ico" type="image/x-icon" 　/>
		<link rel="stylesheet" type="text/css" href="css/common.css" />
		<link rel="stylesheet" type="text/css" href="css/index.css" />
	</head>
	<body class="bg">
		<div class="form_bg">
			<div class="form_box">
				<h3 class="text-center h3 mg_b20">用户注册</h3>
				<p class="form_list mg_b20 relative">
					<img src="img/icon_user.png"/>
					<input type="text" name="" id="tel" value="" placeholder="请输入手机号" />
					<input type="text" name=""  value="获取验证码" class="generate_code absolute" readonly="readonly"   onfocus="this.blur()" />
				</p>
				<p class="form_list mg_b20">
					<img src="img/icon_code.png"/>
					<input type="text" name="" id="code" value="" placeholder="请输入手机验证码" />
				</p>
				<p class="form_list mg_b20">
					<img src="img/icon_psda.png"/>
					<input type="password" name="" id="psd" value="" placeholder="请输入密码" />
				</p>
				<p class="form_list mg_b20">
					<img src="img/icon_psda.png"/>
					<input type="password" name="" id="re_psd" value="" placeholder="请确认密码" />
				</p>
				<p class="clearfix">
					<a href="login.html" class="left">我已同意<i class="blue">立即登录</i></a>
				</p>
				<p class="width100 text-center mg_top30"><a href="javascript:;" class="width100 big-btn">注册</a></p>
				<p class=" text-center mg_top20">
					<input type="radio" name="" id="" value="" />
					<a href="javascript:;" >同意《用户协议》</a>
				</p>
			</div>
		</div>
		<div class="foot">
			<div class="clearfix text-center">
			    <a href="index.html">首页</a>
				<a href="javascript:;"  class="line">联系我们</a>
				<a href="javascript:;">关于我们</a>
			</div>
			<p class="text-center mg_tb20 color_ff">版权所有成都汤沐科技有限公司Copyright2005-2015</p>
		</div>
		<div class="msg-spring"></div>
	</body>
	<script src="js/jquery-1.7.1.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="js/index.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		// 发送验证码
        $('.generate_code').click(function(){
            var tel = $('#tel').val();
            if (tel!=''&&(/^1[34578]\d{9}$/.test(tel))){
                $.ajax({
                	headers: {},
//                      url:urlcom + 'sned_sms',
                    dataType:'json',
                    type:'post',
                    data:{
                        mobile:tel,
                        type:1,  //1：注册；2：修改密码；3：短信登录
                    },
                    success:function(res){
                    	if(res.code==1){
                        msg('验证码发送成功')
                        settime();
                    	}else{
                    		 msg(res.msg)
                    	}
                    }
                })
            } else{
                msg('请输入正确的手机号')
            }
        });
        //注册
		function reg(){
				var tel = $('#tel').val()
				var code = $('#code').val()
				var psd = $('#psd').val()
				var re_psd = $('#re_psd').val()
				if(!tel){
					msg('请输入电话号码')
					return false;
				}
				if(!psd){
					msg('请输入密码')
					return false;
				}
				if(!re_psd && !re_psd===psd){
					msg('请再次确认密码')
					return false;
				}
				$.ajax({
					type:"post",
					url:urlcom+"",
					async:true,
					dataType:'json',
					success:function(res){
						if(res.code==1){
							window.localStorage.setItem('user_token',res.data.token)
							window.location.href='index.html';
						}else{
							msg(res.msg)
						}
					}
				});
			}
	</script>
</html>
